/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.partaljevic.gambling.beans;

import com.partaljevic.gambling.Customer;
import com.partaljevic.tapestry.gambling.service.Customers;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Danilo
 */
public class CustomersBean implements Customers{

    private Map<String,Customer> customers;

    public CustomersBean(Map<String, Customer> customers) {
        super();
        this.customers = customers;
    }

    public CustomersBean() {
        this(new HashMap<String,Customer>());
    }

    @Override
    public Customer save(Customer customer) {
        customers.put(customer.getUsername(), customer);
        return customer;
    }

    @Override
    public Collection<Customer> retrieve() {
        return customers.values();
    }

    @Override
    public Customer retrieve(Serializable username) {
        return customers.get(username);
    }

    @Override
    public void update(Customer customer) {
//        update
    }

    @Override
    public Collection<Customer> retrieveCustomers() {
        return null;
    }

    @Override
    public void deleteCustomer(Customer customer) {
    }

}
